Utils Class Reference

Inherits from NSObject
Declared in Utils.h
Utils.mm

Other Methods

+ imageWithScaleImage:andScaleWidth:

图片缩放(Image Zoom)

+ (UIImage *)imageWithScaleImage:(UIImage *)image andScaleWidth:(int)width

Parameters

image

原图(The original image)

width

目标宽度(The target width)

Discussion

图片缩放(Image Zoom)

Declared In

Utils.h

+ printEscData:

ESC指令图片数据(ESC instruction picture data)

+ (NSData *)printEscData:(UIImage *)image

Parameters

image

图片(Image)

Discussion

ESC指令图片数据(ESC instruction picture data)

Declared In

Utils.h

+ printTscData:

TSC指令图片数据(TSC instruction picture data)

+ (NSData *)printTscData:(UIImage *)image

Parameters

image

图片(Image)

Discussion

TSC指令图片数据(TSC instruction picture data)

Declared In

Utils.h

+ printTscData:andMode:

Tsc指令图片数据(TSC instruction picture data)

+ (NSData *)printTscData:(UIImage *)image andMode:(int)mode

Parameters

image

图片(Image)

mode

模式 0:不压缩 3:压缩(mode 0:Non-compacting 3:compression)

Discussion

Tsc指令图片数据(TSC instruction picture data)

Declared In

Utils.h

+ printCpclData:

CPCL指令图片数据(CPCL instruction picture data)

+ (NSData *)printCpclData:(UIImage *)image

Parameters

image

图片(Image)

Discussion

CPCL指令图片数据(CPCL instruction picture data)

Declared In

Utils.h

+ printCpclData:withThreshold:

CPCL指令图片数据(CPCL instruction picture data)

+ (NSData *)printCpclData:(UIImage *)image withThreshold:(int)threshold

Parameters

image

图片(Image)

threshold

二值化阈值 0:自动 1-255:手动(Binarization threshold 0: automatic 1-255: manual)

Discussion

CPCL指令图片数据(CPCL instruction picture data)

Declared In

Utils.h

+ binaryzation:withThreshold:withReverse:

图像二值化 - 指定阈值 (Image binarization - Specify Thresholds)

+ (UIImage *)binaryzation:(UIImage *)image withThreshold:(int)threshold withReverse:(BOOL)reverse

Parameters

image

图片(Image)

threshold

阈值 0-255 (threshold 0-255)

reverse

黑白反转 (Black and white and reverse)

Discussion

图像二值化 - 指定阈值 (Image binarization - Specify Thresholds)

Declared In

Utils.h

+ binaryzationAutoThreshold:withReverse:

图像二值化 - 自适应阈值 (Image binarization - Adaptive thresholds)

+ (UIImage *)binaryzationAutoThreshold:(UIImage *)image withReverse:(BOOL)reverse

Parameters

image

图片(Image)

reverse

黑白反转 (Black and white and reverse)

Discussion

图像二值化 - 自适应阈值 (Image binarization - Adaptive thresholds)

Declared In

Utils.h

+ grayImage:

图像灰度化处理(Image graying processing)

+ (UIImage *)grayImage:(UIImage *)image

Parameters

image

图片(Image)

Discussion

图像灰度化处理(Image graying processing)

Declared In

Utils.h

+ convertGreyImgByFloyd:

图片处理。使用该方法处理需打印图片,图片将进行灰度化及抖动处理,保留图片信息较全 Image processing. This method is used to process the picture to be printed, the picture will be grayscale and dither processing, to retain the picture information is more complete

+ (UIImage *)convertGreyImgByFloyd:(UIImage *)img

Parameters

img

需打印的图像(Image)

Discussion

图片处理。使用该方法处理需打印图片,图片将进行灰度化及抖动处理,保留图片信息较全 Image processing. This method is used to process the picture to be printed, the picture will be grayscale and dither processing, to retain the picture information is more complete

Declared In

Utils.h

+ barcodeTypeToStr:

BarcodeType -> String

+ (NSString *)barcodeTypeToStr:(BarcodeType)type

Parameters

type

BarcodeType

Discussion

BarcodeType -> String

Declared In

Utils.h

+ alignmentToStr:

Alignment -> String

+ (NSString *)alignmentToStr:(Alignment)alignment

Parameters

alignment

Alignment

Discussion

Alignment -> String

Declared In

Utils.h

+ textAlignmentToStr:

TextAngle -> String

+ (NSString *)textAlignmentToStr:(TextAngle)angle

Parameters

angle

TextAngle

Discussion

TextAngle -> String

Declared In

Utils.h

+ qrcodeLevelToStr:

QRCodeLevel -> String

+ (NSString *)qrcodeLevelToStr:(QRCodeLevel)level

Parameters

level

QRCodeLevel

Discussion

QRCodeLevel -> String

Declared In

Utils.h

+ qrcodeInputModeToStr:

Mode -> String

+ (NSString *)qrcodeInputModeToStr:(Mode)mode

Parameters

mode

Mode

Discussion

Mode -> String

Declared In

Utils.h

+ orientationToStr:

Orientation -> String

+ (NSString *)orientationToStr:(Orientation)orientation

Parameters

orientation

orientation

Discussion

Orientation -> String

Declared In

Utils.h

+ checkStringIsNumber:

检测字符串是否为数字(Checks if the string is a number)

+ (BOOL)checkStringIsNumber:(NSString *)str

Parameters

str

字符串(String)

Discussion

检测字符串是否为数字(Checks if the string is a number)

Declared In

Utils.h

+ graphicsToStr:

Graphics -> String

+ (NSString *)graphicsToStr:(Graphics)graphics

Parameters

graphics

Graphics

Discussion

Graphics -> String

Declared In

Utils.h

+ view2Image:

截图(screenshot)

+ (UIImage *)view2Image:(UIView *)views

Parameters

views

目标视图(Objective view)

Discussion

截图(screenshot)

Declared In

Utils.h

+ image:rotation:

改变图片方向(Change the orientation of the picture)

+ (UIImage *)image:(UIImage *)image rotation:(UIImageOrientation)orientation

Parameters

image

图片(Image)

orientation

方向(orientation)

Discussion

改变图片方向(Change the orientation of the picture)

Declared In

Utils.h

Other Methods

+ binaryzation:withThreshold:

图像二值化 - 指定阈值 (Image binarization - Specify Thresholds)

+ (UIImage *)binaryzation:(UIImage *)image withThreshold:(int)threshold

Parameters

image

图片(Image)

threshold

阈值 0-255 (threshold 0-255)

Discussion

图像二值化 - 指定阈值 (Image binarization - Specify Thresholds)

Declared In

Utils.h

+ binaryzationAutoThreshold:

图像二值化 - 自适应阈值 (Image binarization - Adaptive thresholds)

+ (UIImage *)binaryzationAutoThreshold:(UIImage *)image

Parameters

image

图片(Image)

Discussion

图像二值化 - 自适应阈值 (Image binarization - Adaptive thresholds)

Declared In

Utils.h